#include<iostream>

float p(int m, int n)
{
	if (n == 0)
		return (1);
	else if (n == 1)
		return (m);
	else
		return(((2 * n - 1)*m*p((n - 1), m) - (n - 1)*p((n - 2), m)) / n);
}

int main()
{
	using namespace std;

	int m, n;
	float p(int, int);
	cout << "input m & n";
	cin >> m >> n;
	cout << "P" << m << "(n)=" << p(m, n) << endl;

	return 0;
}
